import { Progress } from 'antd';
import React, { useEffect, useState } from 'react';

const App: React.FC = () => {
  const [left, setLeft] = useState<number>(50);
  const [rigth, setRigth] = useState<number>(50);

  const preset = () => {
    return left / (left + rigth) * 100;
  }

  useEffect(() => {
    const inter = setInterval(() => {
        const random:number = ((Math.random()*10).toFixed(0)) % 4;
        if (random === 1) {
            setLeft((left) => left+1);
        } else {
            setRigth((rigth) => rigth+1);
        }
    },5000)
   return () => {
      clearInterval(inter);
   }
  },[]);

  console.log(rigth);
  console.log(left);

  return (
  <div style={{padding: 200}}>
    <Progress percent={preset()} showInfo={false} />
  </div>
  )
};

export default App;